import { _decorator, clamp, Component, Node } from 'cc';
import { Const } from './Const';
const { ccclass, property } = _decorator;

@ccclass('Camera')
export class Camera extends Component {
    start() {

    }

    update(deltaTime: number) {
        this.node.worldPosition = Const.ndPlayer.worldPosition;


        const x = clamp(this.node.position.x, -850, 850);
        const y = clamp(this.node.position.y, -850, 850);
        this.node.setPosition(x, y);
    }
}


